package com.jushu.storbox.util;

import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.content.Context;
import android.os.Build;

public class MemoryUtil {

	public static long getDeviceAvailableMemory(Context context) {
		ActivityManager.MemoryInfo m = new ActivityManager.MemoryInfo();
		ActivityManager AM = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
		AM.getMemoryInfo(m);
		return m.availMem;
	}
	
	@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
	public static long getDeviceTotalMemory(Context context) {
		ActivityManager.MemoryInfo m = new ActivityManager.MemoryInfo();
		ActivityManager AM = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
		AM.getMemoryInfo(m);
		return m.totalMem;
	}
}
